#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

class Solution {
public:
    long long StringToInt(string s){
        long long ans = 0;
        int ix=0;
        while(ix<s.size() && s[ix]==0){
            ix++;
        }
        while(ix < s.size() && s[ix]!='.'){
            ans = ans*10 + s[ix]-'0';
            ix++;
        }

        return ans;
    }

    int compareVersion(string version1, string version2) {
        int ix=0,jx=0;
        int len1=version1.size(),len2 = version2.size();
        version1+='.';
        version2+='.';
        long long v1,v2;
        // 1 删除前导零
        // 2 以.作为分割符号
        while(1){
            // 先用点将其进行分割，然后提取出前面的数字
            if(ix != -1){
                int dotix1 = version1.find('.',ix);
                if(dotix1 == -1){
                    // 后续没有分割的整数了，直接是o
                    v1 = 0;
                    ix = -1;
                } else {
                    v1= StringToInt(version1.substr(ix,dotix1));
                    ix = dotix1+1;
                }
                
            }
            if(jx != -1){
                int dotix2 = version2.find('.',jx);
                if(dotix2 == -1){
                    // 后续没有分割的整数了，直接是o
                    v2 = 0;
                    jx = -1;
                } else {
                    v2= StringToInt(version2.substr(jx,dotix2));
                    jx = dotix2+1;
                }
            }

            if(v1 == v2){
                if(ix == -1 && jx== -1){
                    return 0;
                }
                continue;
            } else if(v1 < v2){
                return -1;
            } else {
                return  1;
            }
        }
    }
};

int main()
{
    Solution solution;
    cout<<solution.compareVersion("1.01","1.001.0")<<endl;
    return 0;
}